$(function(){ 
	window.StudentProfileView = _PageView.extend({
		//el : '#base .body .page',
		el : '#base .body',
		url : function() {
			var base = 'students';
			if (this.isNew()) return base;
			return base + (base.charAt(base.length - 1) == '/' ? '' : '/') + this.id;
		},
		initialize : function() {
			this.template = _.template($('#student-profile-template-read').html());
			_.bindAll(this, 'render');
            this.model.bind('change', this.render);
		},
		events: {
		  "click .update" : "edit"
		},

		render : function() { 
			var renderedContent = this.template(this.model.toJSON());
			actionTemplate = _.template($('#actions-template').html());  
			$(this.el).find('.page').html(renderedContent);
			
			//show the actions btn
			actions = new Actions({update:true, close:true});
			var renderedContentActions = actionTemplate(actions.toJSON());
			$(this.el).find('.actions').html(renderedContentActions);
			 
			return this;
		},
		onClose: function(){
			//this.model.unbind("change", this.render);
		}
	});
});
